package Week1;

import java.io.*;
import java.util.*;

public class Day3 {
}

//牛客:BC149 简写单词
// 注意类名必须为 Main, 不要有任何 package xxx 信息
class Main6 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        s = " " + s;
        char[] ch = s.toCharArray();
        StringBuffer ret = new StringBuffer();
        for(int i = 1; i < ch.length; i++){
            if(ch[i-1] == ' '){
                //将小写字母转为大写
                if(ch[i] >= 'a' && ch[i] <= 'z'){
                    ch[i] -= 32;
                }
                ret.append(ch[i]);
            }
        }
        System.out.println(ret.toString());
    }
}

//牛客:NC221681 dd爱框框
// 注意类名必须为 Main, 不要有任何 package xxx 信息
class Main7 {
    public static void main(String[] args) throws IOException {
        //快读
        Read in = new Read();
        int n = in.nextInt();
        int x = in.nextInt();
        int[] arr = new int[n+1];
        for(int i = 1; i <= n; i++){
            arr[i] = in.nextInt();
        }
        //滑动窗口，找到窗口内数和为x的数，并记录这个窗口的长度，每次得到等于x的窗口时进行判断得到最小的窗口长度
        int left = 1 , right = 1 , len = n;
        int leftx = 0 , rightx = 0;
        int sum = 0;
        while(right <= n){
            //计算窗口内数据和
            sum += arr[right];
            //如果和大于x
            while(sum >= x){
                //如果长度是小于上一个符合要求的长度时，更新新的最小窗口两边位置和长度
                if(right - left + 1 < len){
                    leftx = left;
                    rightx = right;
                    len = right - left + 1;
                }
                //移动窗口
                sum -= arr[left++];
            }
            right++;
        }
        System.out.println(leftx+" "+rightx);
    }
}

//快读模板
class Read {
    StringTokenizer st = new StringTokenizer("");
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    String next() throws IOException
    {
        while(!st.hasMoreTokens())
        {
            st = new StringTokenizer(bf.readLine());
        }
        return st.nextToken();
    }
    String nextLine() throws IOException
    {
        return bf.readLine();
    }

    int nextInt() throws IOException
    {
        return Integer.parseInt(next());
    }

    long nextLong() throws IOException
    {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException
    {
        return Double.parseDouble(next());
    }
}


class Main8 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        //优先级队列进行从大到小排序
        PriorityQueue<Integer> q = new PriorityQueue<>((a,b) -> b - a);
        long sum = 0;
        //将所有的数传入队列中排序，并计算所有数的和
        for(int i = 0; i < n; i++){
            long x = in.nextLong();
            sum += x;
            q.add((int)x);
        }
        //如果此时的队列不为空且还可以进行除2
        while(!q.isEmpty() && k != 0){
            //弹出队头元素
            long y = q.poll();
            //如果此时的元素为偶数就进行除2
            if(y % 2 == 0){
                //将总和减去除2后的值
                sum -= y / 2;
                //重新放入队列中排序
                q.add((int)(y / 2));
                //次数减少
                k--;
            }
        }
        System.out.println(sum);
    }
}